feat: add pyproject.toml for package installation support#195
feat: add pyproject.toml for package installation support#195thecaptain789 wants to merge 2 commits intoPolymarket:mainfrom
Conversation
Enable installation via package managers (pip, uv, poetry) directly
from Git sources:
uv add git+https://github.com/Polymarket/agents.git
pip install git+https://github.com/Polymarket/agents.git
The pyproject.toml includes:
- Core dependencies extracted from requirements.txt
- Flexible version constraints for better compatibility
- Optional dev dependencies for testing/linting
- Python 3.9+ support as per README
- Proper package discovery for the agents module
Fixes Polymarket#38
Adds scheduler>=0.8.7 to dependencies list. This package is required by agents/application/cron.py which imports Scheduler and Monday trigger.
|
Good catch! Just pushed a fix adding |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
|
|
||
| [tool.setuptools.packages.find] | ||
| where = ["."] | ||
| include = ["agents*"] |
There was a problem hiding this comment.
Package discovery fails without init.py files
High Severity
The [tool.setuptools.packages.find] configuration uses the default find_packages() behavior, which requires __init__.py files in each package directory. The agents directory and its subdirectories do not contain __init__.py files (the README even instructs users to set PYTHONPATH="." as a workaround). Without adding namespaces = true to enable PEP 420 implicit namespace package discovery, setuptools won't find any packages to include. The installation will succeed but the agents module won't be importable.
| "scheduler>=0.8.7", | ||
| "tavily-python>=0.3.0", | ||
| "web3>=6.0.0", | ||
| ] |
There was a problem hiding this comment.
Missing httpx dependency in pyproject.toml
High Severity
The httpx library is imported and used in agents/polymarket/polymarket.py and agents/polymarket/gamma.py, but it's not listed in the dependencies array. Users who install the package will encounter ModuleNotFoundError: No module named 'httpx' when trying to use the Polymarket or GammaMarketClient classes.


Summary
Adds a
pyproject.tomlto enable installation via standard Python package managers directly from Git sources.Motivation
Currently, the project can only be used as a checked-out source tree. This PR enables:
Changes
Added
pyproject.tomlwith:requirements.txtwith flexible version constraintsagentsmoduleDependency Notes
The dependencies use minimum version constraints (e.g.,
>=0.2.0) rather than pinned versions fromrequirements.txtto:The original
requirements.txtremains available for users who prefer exact pinned versions.Testing
Verified that the package can be installed with:
pip install -e .Related Issue
Fixes #38
Note
Low Risk
Packaging-only change that doesn’t alter runtime logic; main risk is dependency/version resolution differences for consumers due to
>=constraints.Overview
Adds a new
pyproject.tomlto make the repo installable as a standard Python package (setuptools/wheel build backend) with declared metadata and Python>=3.9support.Moves runtime requirements into the package definition as minimum-version dependencies, adds optional
devextras (pytest,pre-commit), and configures setuptools package discovery to includeagents*.Written by Cursor Bugbot for commit c0131a2. This will update automatically on new commits. Configure here.